"""
登录页面类
"""
from selenium.webdriver.common.by import By
from pages.base_page import BasePage

"""登录页面做的操作 输入账户，输入密码，点击登录"""
class LoginPage(BasePage):
    url = "http://192.168.0.161/crm/index.php?m=user&a=login"
    username_locator = (By.NAME, 'name')
    password_locator = (By.NAME, 'password')
    btn_locator = (By.NAME, 'submit')

    def input_username(self, username):
        """输入用户名"""
        self.driver.find_element(*self.username_locator).send_keys(username)

    def input_password(self, password):
        """输入密码"""
        self.driver.find_element(*self.password_locator).send_keys(password)

    def click_btn(self):
        """点击登录按钮"""
        self.driver.find_element(*self.btn_locator).click()